<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a >商品列表</a></li>
			<li ><a href="{:url('Shopgoods/add')}">添加平台自营商品</a></li>

		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('Shopgoods/index')}">
		
			推荐：
			<select class="form-control" name="isrecom" >
				<option value="">全部</option>
					<option value="1" <if condition="input('request.isrecom') neq '' && input('request.isrecom') eq 1">selected</if>>是</option>
					<option value="0" <if condition="input('request.isrecom') neq '' && input('request.isrecom') eq 0">selected</if>>否</option>
			</select>

			商品类型：
			<select class="form-control" name="goods_type" >
				<option value="">全部</option>
				<volist name="type" id="vo">
					<option value="{$key}" <if condition="input('request.goods_type') neq '' && input('request.goods_type') eq $key">selected</if>>{$vo}</option>
				</volist>
					
			</select>
			
			提交时间：
			<input class="form-control js-bootstrap-date" name="start_time" id="start_time" autocomplete="off" value="{:input('request.start_time')}" aria-invalid="false" style="width: 110px;"> - 
            <input class="form-control js-bootstrap-date" name="end_time" id="end_time" autocomplete="off" value="{:input('request.end_time')}" aria-invalid="false" style="width: 110px;">
			用户： 
            <input class="form-control" type="text" name="uid" style="width: 200px;" value="{:input('request.uid')}"
                   placeholder="请输入会员ID、靓号">
            名称： 
            <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
                   placeholder="请输入商品名称">
			<input type="submit" class="btn btn-primary" value="搜索">
			<a class="btn btn-danger" href="{:url('Shopgoods/index')}">清空</a>
		</form>				
		<form method="post" class="js-ajax-form" >
			<div class="table-actions">
                <!-- <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('Shopgoods/del')}"
                        data-subcheck="true">批量删除
                </button> -->

                <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('Shopgoods/setStatus',array('status'=>'-2'))}"
                        data-subcheck="true">批量下架
                </button>

                <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('Shopgoods/setStatus',array('status'=>'1'))}"
                        data-subcheck="true">批量取消下架
                </button>

                <p class="help-block" style="font-weight: bold;">批量操作请谨慎</p>
            </div>
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th width="16">
							
                            <label>
                                <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                            </label>
                        	
                        </th>
						<th>ID</th>
						<th>会员</th>
						<th width="10%">商品名称</th>
						<th width="10%">商品类型</th>
						<th>一级分类</th>
						<th>二级分类</th>
						<th>三级分类</th>
						<th>外链商品地址</th>
						<th>外链商品原价</th>
						<th>外链商品现价</th>
						<th>封面</th>
						<th>邮费</th>
						<th>分享购买佣金</th>
						<th>销量</th>
						<th>状态</th>
						<th>提交时间</th>
						<th>{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
					<foreach name="lists" item="vo">
					<tr>
						<td>
							<if condition="$vo['status'] eq '1' or $vo['status'] eq '-2'">
                            	<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}">
                            </if>
                        </td>
						<td>{$vo.id}</td>
						<td>
							<if condition="$vo['uid'] eq '1'">
								平台自营
							<else />
								{$vo['userinfo']['user_nickname']} ({$vo.uid})
							</if>
						</td>
						<td>{$vo['name']}</td>
						<td>{$type[$vo['type']]}</td>
						<td>{$vo['oneclass_name']}</td>
						<td>{$vo['twoclass_name']}</td>
						<td>{$vo['threeclass_name']}</td>
						<td style="max-width: 200px;word-wrap:break-word;">{$vo['href']}</td>
						<td>{$vo['original_price']}</td>
						<td>{$vo['present_price']}</td>
						<td><img src="{$vo['thumb']}" class="imgtip" width="60"></td>
						<td>{$vo['postage']}</td>
						<td>{$vo['share_income']}</td>
						<td>{$vo['sale_nums']}</td>
                        			<td>{$status[$vo['status']]}</td>
						<td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>
						<td>
							<if condition="$vo['status'] eq 0 && $vo['uid'] gt 1">
                            	<a class="btn btn-xs btn-primary" href='{:url("Shopgoods/edit",array("id"=>$vo["id"]))}'>审核</a>
                            <elseif condition="$vo['status'] eq -2">
                            	<a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('Shopgoods/setstatus',array('id'=>$vo['id'],'status'=>'1'))}" >取消下架</a>
                            <else />
                            	<if condition="$vo['type'] neq 2">
                            		<a class="btn btn-xs btn-primary" href='{:url("Shopgoods/edit",array("id"=>$vo["id"]))}'>详情</a>
                            	<else />
                            		<a class="btn btn-xs btn-primary" href='{:url("Shopgoods/platformedit",array("id"=>$vo["id"]))}'>编辑</a>
                            	</if>
                            	<if condition="$vo['status'] eq 1">
                            		<a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('Shopgoods/setstatus',array('id'=>$vo['id'],'status'=>'-2'))}" >下架</a>
                            	</if>
                            </if>
                            <if condition="$vo['isrecom'] eq 1">
                            <a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('Shopgoods/setRecom',array('id'=>$vo['id'],'isrecom'=>'0'))}" >取消推荐</a>
                            <else/>
                            <a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('Shopgoods/setRecom',array('id'=>$vo['id'],'isrecom'=>'1'))}" >推荐</a>
                            </if>
                            <if condition="$vo['type'] eq '0' or $vo['type'] eq '2'">
                            	<a class="btn btn-xs btn-primary"  onclick="commentlist({$vo['id']})">评论列表</a>
                        	</if>

                            <if condition="$vo['uid'] neq '1' && $vo['status'] eq '1'">
                            	<!-- 展示 -->
                            	<if condition="$vo['live_isshow'] eq '1'">
                            	    <a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('Shopgoods/setLiveisShow',array('id'=>$vo['id'],'isshow'=>'0','uid'=>$vo['uid']))}" >取消直播间弹窗展示</a>
                            	</if>
                            	<!-- 不展示 -->
                            	<if condition="$vo['live_isshow'] eq '0'">
                            	    <a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('Shopgoods/setLiveisShow',array('id'=>$vo['id'],'isshow'=>'1','uid'=>$vo['uid']))}" >设置直播间弹窗展示</a>
                            	</if>
                            </if>
                            <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Shopgoods/del',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
						</td>
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="table-actions">
                <!-- <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('Shopgoods/del')}"
                        data-subcheck="true">批量删除
                </button> -->

                <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('Shopgoods/setStatus',array('status'=>'-2'))}"
                        data-subcheck="true">批量下架
                </button>

                <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('Shopgoods/setStatus',array('status'=>'1'))}"
                        data-subcheck="true">批量取消下架
                </button>

                <p class="help-block" style="font-weight: bold;">批量操作请谨慎</p>
            </div>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript">
		$(function(){
			Wind.use('layer');
		});

		function commentlist(goodsid){
			layer.open({
			  type: 2,
			  title: '商品评论列表',
			  shadeClose: true,
			  shade: 0.8,
			  area: ['90%', '90%'],
			  content: '/admin/Shopgoods/commentlist?goods_id='+goodsid //iframe的url
			});
		}
	</script>
</body>
</html>